package cn.funeralobjects.dictms.web.api;

import cn.funeralobjects.dictms.web.model.VDictRelatePath;
import cn.funeralobjects.dictms.web.model.VDictValuePathDto;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * @author FuneralObjects
 * Create date: 2020/6/9 2:22 PM
 */
@Validated
public interface DictRelatePathApi {

    @GetMapping("/parent/{parentId}")
    Mono<List<VDictValuePathDto>> findByParentId(@PathVariable("parentId") Integer parentId);

    @GetMapping("/{relateId}/first/{headValueId}")
    Mono<List<VDictValuePathDto>> findFirstList(@PathVariable("relateId") Integer relateId,
                                                @PathVariable("headValueId") Integer headValueId);

    @PostMapping("/{relateId}/first/{headValueId}")
    Mono<VDictRelatePath> addFirst(@PathVariable Integer relateId,
                                   @PathVariable Integer headValueId,
                                   @RequestParam Integer dictValueId);

    @PostMapping("/{relateId}/son/{parentId}")
    Mono<VDictRelatePath> addSon(@PathVariable Integer relateId,
                                 @PathVariable Integer parentId,
                                 @RequestParam Integer dictValueId);


}
